#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {

    nums1.insert(nums1.end(),nums2.begin(),nums2.end());
    sort(nums1.begin(),nums1.end());
    int size = nums1.size();
    for(int i=0;i<size;i++)
    {
        cout<<nums1[i]<<",";
    }
    cout<<endl;
    if(size%2 == 0)
    {
        double result = (nums1[size/2-1] + nums1[size/2])/2.0;
        cout<<nums1[size/2-1]<<","<<nums1[size/2]<<endl;
        return result;
    }
    else return nums1[(size-1)/2];
}

int main() {
    vector<int>a;
    a.push_back(1);
    a.push_back(2);
    a.push_back(3);

    vector<int>b;
    b.push_back(4);
    b.push_back(5);
    b.push_back(6);
    b.push_back(7);

    cout<<findMedianSortedArrays(b,a)<<endl;
    return 0;
}